package org.nViron.nvParams;

//~--- JDK imports ------------------------------------------------------------

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Base class that manages parameters
 * @author Roland Haring <p>
 * <script type="text/javascript" src="http://www.ohloh.net/p/376434/widgets/project_basic_stats.js"></script>
 */
public abstract class nvParamMgr {
    private final ArrayList    paramVec;
    private final HashMap params;

    public nvParamMgr() {
        params   = new HashMap();
        paramVec = new ArrayList();
        generateDefaultParams();
    }

    protected int add(Object key, nvParam param) {
        params.put(key, param);
        paramVec.add(key);

        return paramVec.size();
    }

    protected abstract void generateDefaultParams();

    public nvParam get(int index) {
        return (nvParam) params.get(paramVec.get(index));
    }

    protected nvParam get(Object key) {
        return (nvParam) params.get(key);
    }

    public int size() {
        return paramVec.size();
    }
}



